package com.fxpc.hddc.fxqhpriority.jpa.dao.primary;


import com.fxpc.hddc.fxqhpriority.dto.primary.entity.FxqhPriorityEntity;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;


/**
 * @author zyb
 * @date 2020-11-30
 */
@Repository
public interface FxqhPriorityBaseDao extends JpaRepository<FxqhPriorityEntity, String> {

    //select uuid,province,city,area from hddc_activefault where create_time between" +
    //            ":startTime and :endTime
    @Query(nativeQuery = true, value = "select * from fxqh_priority where SUBSTRING(create_time,1,10)= :nowDay  AND is_valid='1'")
    List<FxqhPriorityEntity> findOneDayDataByCreateTime(@Param(value = "nowDay") LocalDate nowDay);


    @Query(nativeQuery = true, value = "select * from fxqh_priority where is_valid='1'")
    List<FxqhPriorityEntity> findAllTime();

    Long count(Specification<FxqhPriorityEntity> specification);
}
